﻿@model Cxuu.Models.EditConfigSiteInfo

@{
    ViewData["Title"] = "网站配置";
}
<div class="content-top-nav">
    <h3 style="color:#444"><i class="layui-icon layui-icon-home"></i>@ViewData["Title"] </h3>
    <hr>
</div>

<div class="layui-fluid" style="margin-bottom:50px;">
    <div class="layui-row layui-col-space15">
        <div class="layui-row">
            <div class="layui-col-md12">
                <form class="layui-form" name="form" lay-filter="setting">
                    <fieldset class="layui-elem-field">
                        <legend>网站信息</legend>
                        <div class="layui-field-box">
                            <div class="layui-form-item">
                                <label asp-for="SiteName" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="SiteName" required lay-verify="required" placeholder="请输入网站名" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label asp-for="SiteUrl" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:260px;">
                                    <input type="text" asp-for="SiteUrl" required lay-verify="required" placeholder="请输入网址" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：https://cxuu.top</div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label asp-for="Description" class="layui-form-label"></label>
                                <div class="layui-input-block">
                                    <textarea type="text" asp-for="Description" required lay-verify="required" placeholder="请输入描述" autocomplete="off" class="layui-input" style="width:600px;height:80px;"></textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label asp-for="Copyright" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:500px;">
                                    <input type="text" asp-for="Copyright" required lay-verify="required" placeholder="请输入版权" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label asp-for="Beian" class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="text" asp-for="Beian" required lay-verify="required" placeholder="请输入备案号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </fieldset>

                    <fieldset class="layui-elem-field">
                        <legend>上传设置</legend>
                        <div class="layui-field-box">
                            <div class="layui-form-item">
                                <label asp-for="BaseDir" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="BaseDir" required lay-verify="required" placeholder="请输入上传目录" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：uploads</div>
                            </div>

                            <div class="layui-form-item">
                                <label asp-for="ImageDir" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="ImageDir" required lay-verify="required" placeholder="请输入图片目录" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：Images</div>
                            </div>

                            <div class="layui-form-item">
                                <label asp-for="ImageExt" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="ImageExt" required lay-verify="required" placeholder="请输入图片类型" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如： .jpg,gif,png</div>
                            </div>
                            <div class="layui-form-item">
                                <label asp-for="ImageSize" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:100px;">
                                    <input type="text" asp-for="ImageSize" required lay-verify="required" placeholder="请输入图片上传大小" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">单位:KB</div>
                            </div>

                            <hr>

                            <div class="layui-form-item">
                                <label asp-for="FileDir" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="FileDir" required lay-verify="required" placeholder="请输入文件目录" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：Files</div>
                            </div>

                            <div class="layui-form-item">
                                <label asp-for="FileExt" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:300px;">
                                    <input type="text" asp-for="FileExt" required lay-verify="required" placeholder="请输入文件类型" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">.txt,.zip,.7z,.doc,docx,.xls,.xlsx</div>
                            </div>

                            <div class="layui-form-item">
                                <label asp-for="FileSize" class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:100px;">
                                    <input type="text" asp-for="FileSize" required lay-verify="required" placeholder="请输入文件大小" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">单位:KB</div>
                            </div>
                        </div>
                    </fieldset>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            @if (CheckExt.AuthView(ViewBag.sr, "config_edit"))
                            {
                                <button type="button" class="layui-btn" lay-submit lay-filter="saveBtn" id="saveBtn">保存</button>
                            }
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'jquery'], function () {
        var form = layui.form,  $ = layui.jquery;

        form.render();
        //监听提交
        $('#saveBtn').click(function () {
            //layer.msg(JSON.stringify(form.val('setting')));
            $.post('/Admin/Config/Edit', { 'name': 'siteinfo', 'data': form.val('setting')}, function (res) {

                if (res.status == 1) {
                    layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                        loadMain('/Admin/Config/Index');
                    });
                } else {
                    layer.msg(res.msg, { icon: 2, anim: 6, time: 5000 });
                }
            });
            return false;
        });
    });
</script>
